import { _list } from '../../common/companies'
const app = getApp()
Page({
  data: {
    banner: 'http://tianyue.1juke.cn/res/qiyegongxiang.png',
    list: [],
    active: null
  },
  activeHandler (e) {
    this.setData({
      active: e.detail
    })
  },
  list () {
    app.loading('加载中')
    _list().then(res => {
      wx.hideLoading()
      this.data.list = res.data.Share_Type_list
      this.setData({
        list: this.data.list
      })
    }).catch(err => {
      console.log(err)
      wx.hideLoading()
      wx.showModal({
        title: '对不起',
        content: '网络错误，请稍后再试',
        showCancel: false
      })
    })
  },
  toggle(e) {
    const index = e.currentTarget.dataset.index
    this.data.list[index].show = !this.data.list[index].show
    this.setData({
      [`list[${index}].show`]: this.data.list[index].show
    })
  },
  animationEnd (e) {
    console.log(e)
  },
  onLoad(options) {
    this.list()
  },
  onReady() { },
  onShow() {},
  onShareAppMessage() {
    return app.shareInfo
  }
})